Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[components] Add windows testing to dagster-dg (BUILD-672) #27537

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

smackesey
Copy link
Collaborator

@smackesey smackesey commented Feb 4, 2025

Summary & Motivation

dagster-dg is currently broken on Windows. I found this out by trying to add Windows testing. This PR fixes dg for Windows and adds Windows testing.

  • Modify our azure pipeline specification to also test dagster-dg.
  • Make sure all paths are handled with Path and don't contain embedded "/"
  • Handle process shutdown appropriately on Windows for dg dev
  • Some adjustments to the tests of console output, since sometimes the box character used to draw tables and panels differ on Windows.

NOTE: There are still some problems with dg dev testing in the CLI environment on Windows, so the dg dev tests are skipped in this PR. They will be re-added upstack.

How I Tested These Changes

Test suite now passes on Windows.

Copy link
Collaborator Author

smackesey commented Feb 4, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@smackesey smackesey marked this pull request as ready for review February 4, 2025 01:52
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch from c5f92c5 to 9894ca5 Compare February 4, 2025 02:00
@smackesey smackesey changed the title [components] Add windows testing to dagster-dg [components] Add windows testing to dagster-dg (BUILD-672) Feb 4, 2025
@smackesey smackesey force-pushed the sean/components/dg-dev branch from 0ad8ae0 to 81af794 Compare February 4, 2025 02:29
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch 4 times, most recently from 7dbac06 to 9995d6c Compare February 4, 2025 16:09
@smackesey smackesey force-pushed the sean/components/dg-dev branch from 81af794 to 594bc15 Compare February 4, 2025 16:09

venv_bin = Path.cwd() / ".venv" / "bin"
with modify_environment_variable(
"PATH", os.pathsep.join([str(venv_bin), os.pathsep, os.environ["PATH"]])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PATH construction has an extra separator due to os.pathsep being included in the join list. This creates paths like /venv/bin::/usr/bin with double separators. The correct construction should be:

os.pathsep.join([str(venv_bin), os.environ['PATH']])

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@smackesey smackesey force-pushed the windows/components/add-windows-testing branch from 9995d6c to f13115a Compare February 4, 2025 16:13
Base automatically changed from sean/components/dg-dev to master February 4, 2025 16:49
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch 12 times, most recently from f4597f5 to a17e230 Compare February 7, 2025 03:26
Comment on lines 125 to 121
def test_join_path():
from pathlib import Path

my_path = Path("foo/bar")
updated_path = my_path / "baz"
print(updated_path)
assert False

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test appears to be a debugging function that was inadvertently committed. It contains a forced failure (assert False) and debug print statements, suggesting it was used to investigate Path joining behavior. Consider removing this test or converting it into meaningful test coverage if path joining behavior needs verification.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

@smackesey smackesey force-pushed the windows/components/add-windows-testing branch from 25c7c84 to fb67fa3 Compare February 10, 2025 13:37
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch from fb67fa3 to bd8f823 Compare February 10, 2025 16:52
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch from bd8f823 to ed918eb Compare February 12, 2025 13:37
@smackesey smackesey changed the base branch from graphite-base/27537 to master February 12, 2025 13:37
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch 2 times, most recently from 3aaa2a9 to ed2eb96 Compare February 12, 2025 16:33
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch 7 times, most recently from c866c43 to 6633929 Compare February 12, 2025 22:21
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch 4 times, most recently from d1fc49e to fcb0c8f Compare February 13, 2025 14:39
@@ -78,6 +77,7 @@ def clear_key(self, key: tuple[str, ...]) -> None:

def clear_all(self) -> None:
shutil.rmtree(self._root_path)
assert not self._root_path.exists()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just confirming this was intentional and not a local testing thing, could imagine warning or something being less disruptive if this didn't happen for some obscure filesystem reason

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that actually was a testing thing, good catch

@@ -31,6 +32,27 @@
CLI_CONFIG_KEY = "config"


def is_windows() -> bool:
return platform.system() == "Windows"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the way we check this in dagster core is slightly different, not sure if that matters

IS_WINDOWS = os.name == "nt"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chatGPT claims sys.platform == "win32" is most robust so going with that.

Comment on lines 39 to 40
def is_macos() -> bool:
return platform.system() == "Darwin"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high confidence this covers all mac flavors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably does, but changed to sys.platform == "darwin" since that is likely most robust.

@@ -85,10 +107,16 @@ def is_executable_available(command: str) -> bool:
return bool(shutil.which(command)) or bool(get_uv_run_executable_path(command))


# Short for "normalize path"-- use this to get the platform-correct string representation of an
# existing string path.
def npath(path: str):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would find normalize_path clearer as a reader fwiw at the expense of your wrist tendons

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea-- changed to cross_platform_string_path for absolute clarity. Mouthful but there's only one callsite anyway.

@smackesey smackesey force-pushed the windows/components/add-windows-testing branch 2 times, most recently from b55cf67 to 29dcb43 Compare February 13, 2025 19:25
@smackesey smackesey force-pushed the windows/components/add-windows-testing branch from 29dcb43 to 00d5369 Compare February 13, 2025 21:50
@smackesey smackesey merged commit ad4a451 into master Feb 13, 2025
14 checks passed
@smackesey smackesey deleted the windows/components/add-windows-testing branch February 13, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants